package com.qf.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsPermissionMapper;
import com.qf.pojo.DtsPermission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * projectName: wokepase1
 *
 * @author: 强力
 * time: 2021/9/11 15:23
 * description:
 */
@Service
public class PermissionServiceImpl implements PermissionService {

    @Autowired
    private DtsPermissionMapper permissionMapper;

    @Override
    public Set<String> findPermByroleId(Integer[] roleIds) {
        Set<String> perset=new HashSet<>();

        QueryWrapper<DtsPermission> queryWrapper=new QueryWrapper<>();
        queryWrapper.in("role_id",roleIds);
        List<DtsPermission> list = permissionMapper.selectList(queryWrapper);
        if (list != null) {
            for (DtsPermission permission : list) {

                perset.add(permission.getPermission());
            }
        }
        return perset;
    }
}
